

import pytest
from selenium import webdriver
from selenium.webdriver.common.by import By
import os
from time import sleep

@pytest.fixture(scope='function')
def generatedriver():
    driver = webdriver.Edge()
    driver.maximize_window()
    driver.implicitly_wait(6)
    driver.get(os.getenv('baseurl'))
    sleep(4)
    yield driver
    driver.quit()

@pytest.fixture(scope='function')
def logindriver():
    driver = webdriver.Edge()
    driver.maximize_window()
    driver.implicitly_wait(6)
    driver.get(os.getenv('baseurl'))
    sleep(3)
    # 点击登录按钮
    loginbutton = driver.find_element(By.CSS_SELECTOR, "#app > div > form > button")
    loginbutton.click()
    sleep(4)

    yield driver
    driver.quit()



